#include <stdio.h>
// 구조체
struct Calc {
    int Plus;
    int Minus;
    int Multiple;
    float Divide;
};
// 함수
struct Calc Exec(int f, int s) {
    struct Calc calc;
    calc.Plus = f + s;
    calc.Minus = f - s;
    calc.Multiple = f * s;
    calc.Divide = f / (float)s;
    return calc;
}
// 메인함수
void main(void) {
    int x = 3; int y = 5; 
    struct Calc calc = Exec(x, y); 
    printf("%d / %d = %.2f\n", x, y, calc.Divide); 
}

 

Comments


Comments are closed